package com.service.impl;
import java.util.List;

import com.dao.UserDAO;

import com.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.service.UserService;
@Service("userService") //user
public class UserServiceImpl  implements UserService {
    @Autowired // 它可以对类成员变量、方法及构造函数进行标注，完成自动装配的工作
    private UserDAO userDAO;
    @Override
    public List<User> getUserByCond(User user) {
        return this.userDAO.getUserByCond(user);
    }
    @Override // 继承接口的新增管理员表数据 返回值0(失败),1(成功)
    public int insertUser(User user) {
        return this.userDAO.insertUser(user);
    }
    @Override // 继承接口的查询管理员表全部数据
    public List<User> getAllUser() {
        return this.userDAO.getAllUser();
    }
    @Override // 继承接口的更新管理员表数据 返回值0(失败),1(成功)
    public int updateUser(User user) {
        return this.userDAO.updateUser(user);
    }

    @Override // 继承接口的按主键删除管理员表数据 返回值0(失败),1(成功)
    public int deleteUser(String id) {
        return this.userDAO.deleteUser(id);
    }
    @Override // 继承接口的按主键查询管理员表数据 返回Entity实例
    public User getUserById(String id) {
        return this.userDAO.getUserById(id);
    }

    public List<User> getUserByUsername(String username) {
        return this.userDAO.getUserByUsername(username);
    }

}
